
<template>
  <div class="message-box__container" v-if="showSelectPayWay">
    <PayWaySelect
      v-model="showSelectPayWay"
      :ways="ways"
      :default-pay-way="defaultPayWay"
      :huaBeiInstallment="huaBeiInstallment"
      @changePayWay="changePayWay"
      :price="ratePrice"
    >
    </PayWaySelect>
  </div>
</template>

<script>
import PayWaySelect from "./PayWaySelect.vue";
export default {
  data() {
    return {
      showSelectPayWay: false,
      promiseResolve: null,
      promiseReject: null,
    };
  },
  components: {
    PayWaySelect,
  },
  props: ["ways", "ratePrice", "defaultPayWay", "huaBeiInstallment"],
  methods: {
    hideBox() {
      this.showSelectPayWay = false;
    },
    showBox() {
      this.showSelectPayWay = true;
      return new Promise((resolve, reject) => {
        this.promiseResolve = resolve;
        this.promiseReject = reject;
      });
    },
    changePayWay(val) {
      this.promiseResolve(val);
      this.hideBox();
    },
  },
};
</script>